

<?php
	session_start();//使用session
  require_once('system/myfunction.php');   
    require_once('system/DB_connect.php');  
  $username = $_POST["username"];
  $pwd = $_POST["pwd"];
  connect();
  //编写sql语句
  $sql = "select * from employees where username='".$username."' and pass=('".$pwd."')"; 
  $staff=fetch_array($sql);
  $result=fetch_one($sql);
  if($result){
   	 $_SESSION['user']=$result;//权限判断
    //3秒后转向用户列表页面
  	 $sql = "select * from admin where adminname='".$username."' and pw=('".$pwd."')"; 
  	 $result2=fetch_one($sql);
   } 
?>


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title></title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="stylesheets/theme.css">
    <link rel="stylesheet" href="lib/font-awesome/css/font-awesome.css">
    <script src="lib/jquery-1.7.2.min.js" type="text/javascript"></script>

    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
  </head>

  <!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
  <!--[if IE 7 ]> <body class="ie ie7 http-error"> <![endif]-->
  <!--[if IE 8 ]> <body class="ie ie8 http-error"> <![endif]-->
  <!--[if IE 9 ]> <body class="ie ie9 http-error"> <![endif]-->
  <!--[if (gt IE 9)|!(IE)]><!--> 
  <body class="http-error"> 
  <!--<![endif]-->
    


    
<!-- <a href="index.php?c=index&m=staff">Come to List of staff </a> -->
    
        <div class="row-fluid">
    <div class="http-error">
        <div class="http-error-message">
            <div class="error-caption">
                <p>Login</p>
            </div>
            <div class="error-message">
                <p>Welcome!<p>
                <p class="return-home"><?php if($result){
                  if($result2){
                     echo "<a  href='index.php?c=index&m=manager_login'>Come to your Home</a> ";
                  }else{
                    echo " <a  href='index.php?c=index&m=staff_login&id=".$staff[0]['id']."'>Come to Home</a>
                            ";
                  }  
                } else{
                  echo "<a  href='index.php?c=index&m=login'>Relogin</a> ";
                }

                ?></p>
            </div>
        </div>
    </div>
</div>





    


    <script src="lib/bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });
    </script>
    
  </body>
</html>


